package com.ynding.cloud.auth.server.admin;

import com.ynding.cloud.common.annotation.CustomSwaggerConfig;
import com.ynding.cloud.common.redis.data.annotation.CustomLettuceRedisDataConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * <p> </p>
 *
 * @author ynding
 * @version 2021/6/11
 **/
@SpringBootApplication
@EnableDiscoveryClient
@CustomSwaggerConfig
@CustomLettuceRedisDataConfig
@MapperScan("com.ynding.cloud.auth.server.admin.dao")
@EnableDubbo
public class AuthServerAdminApplication {

    /**
     * passwordEncoder 配置在config类里报错循环依赖，暂时将其写在启动类里，不报错
     * Spring 对密码加密的封装
     */
    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    public static void main(String[] args) {
        SpringApplication.run(AuthServerAdminApplication.class, args);
    }
}
